<?php

/**
 * @author Huiyi
 */
class announcements_model extends CI_Model {

    function __construct() {
        parent::__construct();
    }
	
	   function parseAnnouncementsXml($xmlAnnouncementsUrl) {
	   
	   $AnnouncementsOne = array();
	   $announcements = "";
       $date = "";

	   $AnnouncementsOneData = simplexml_load_file($xmlAnnouncementsUrl);
       $AnnouncementsInfoList = array();
		$announcementsInfo = array();
	
		//get the number of announcements
		$announcementsCount = count($AnnouncementsOneData->array->array);
		for ($i = 0; $i < $announcementsCount; $i++) 
		{
            $announcement = $AnnouncementsOneData->array->array[$i];
			
			$date = (string) $announcement->string[0];
			$announcements = (string) $announcement->string[1];
			
			 $announcementsInfo[] = array('date' => $date, 'announcements' => $announcements);
			 
		}		
        $AnnouncementsInfoList = array('announcementsInfo' => $announcementsInfo);
        return $AnnouncementsInfoList;
    }
}
	
	   
	
	
	
	
	
	
	
	